import 'package:flutter/material.dart';
import 'package:ichinesereader/constants.dart';
import 'package:ichinesereader/pages/student/audiobooks.dart';
import 'package:ichinesereader/routes/routePages.dart';
import 'package:ichinesereader/themes/pageStyles.dart';
import 'package:ichinesereader/utils/log.dart';
import 'package:get/get.dart';
import 'package:ichinesereader/widgets/layouts/appdrawerIndividual.dart';
import 'package:ichinesereader/widgets/layouts/customAppBar.dart';
import 'package:ichinesereader/widgets/sidebars/individualSidebar.dart';

class IndividualAudioBooksPage extends StatefulWidget {
  static const String routeName = '/individual/audiobooks';

  @override
  _IndividualAudioBooksPageState createState() =>
      _IndividualAudioBooksPageState();
}

class _IndividualAudioBooksPageState extends State<IndividualAudioBooksPage> {
  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    Log.debug('build AudioBooksPage');
    final isSmallScreen =
        MediaQuery.of(context).size.width < Constants.DefinedScreenSmallSize;
    final isBigScreen =
        MediaQuery.of(context).size.width > Constants.DefinedScreenBigSize;
    int _selectedSidebarItem = RoutePages.studentPageItems
        .indexWhere((page) => page.route == Get.currentRoute);
    final PageStyles _pageStyles = PageStyles();

    return Scaffold(
      appBar: isSmallScreen ? CustomAppBar(title: 'Audio Books'.tr) : null,
      drawer: isSmallScreen ? IndividualAppDrawer() : null,
      body: Container(
        decoration: _pageStyles.pageBoxDecoration(),
        child: Container(
          //margin: EdgeInsets.only(left: 9.0),
          child: Row(
            children: [
              Visibility(
                  visible: !isSmallScreen,
                  child: Container(
                      child: IndividualSidebarX(
                          selectedIndex: _selectedSidebarItem,
                          isBigScreen: isBigScreen))),
              Expanded(
                child: Container(
                  margin: _pageStyles.mainContainerPageEdgeInsets(),
                  child: Column(
                    children: [
                      Playlist(),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
